The invention relates to a cache memory control apparatus suitable for an arithmetic control unit (ACU) having a cache memory and, more particularly, to a cache memory control apparatus which can prevent partial write of data at a cache hit in a write mode and reduce occupying time of a main memory.
Generally, when a memory write instruction or request for a main memory is generated, in the cache memory control apparatus of an arithmetic control unit, a directory check is performed to determine whether a cache hit has been made, i.e., if data in a block of an address specified by the memory write instruction is stored in the cache memory. If a cache hit has been made, a directory corresponding to the block specified by the memory write instruction is cancelled to invalidate the data in the corresponding block in the cache memory. In this state, a write operation is performed for the main memory. This write operation may result in a partial write or in a read-modified write when data to be written is not word-length data, but byte-length data. In a case where one word is N-times (where N is an integer) as large as a minimum unit of data to be processed in the arithmetic control unit (for example, one word consists of 8 bytes) and where at least one byte of write data is written into the main memory, associated one-word data is read out therefrom, and the write data is substituted for data in associated one-word data corresponding thereto. The substituted word data is then written into the main memory. In the prior art cache memory control apparatus, there is a strong possibility that the write operation for the main memory may result in a partial write. Thus, a partial write results in two operations of read and write for the same block in the main memory, thereby disadvantageously requiring approximately twice as much time as is required for the word write operation.
Further, the prior art cache memory control apparatus has a problem, in that the cache hit rate is reduced, since the associated directory is cancelled when a cache hit is made at the write operation. To prevent this problem from occurring, in place of cancelling the associated directory, it has been proposed to read out the word data in the associated block containing the write data after the write data has been written in the main memory. Such a method, however, only performs beforehand the operation to be performed when a hit is not made and does not provide any efficient solution.